package com.mapbased.cc.form;

import java.io.IOException;
import com.mapbased.wfw.RenderContext;
import com.mapbased.wfw.PageLoader;
import org.dom4j.Element;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: mapbased.com</p>
 *
 * @author Chang Huanyou (Baily)
 * @version 1.0
 */
public class TextAreaFormElement
    extends FormElement
{

    /***
     *
     *
     *
     <script language="JavaScript" type="text/javascript">


                           initRTE("images/", "", "", true);


                                                </script>
     <script language="JavaScript" type="text/javascript">
                           writeRichText('rte1', 'ss', 400, 200, true, false);
                             var _form =findForm("Text1");
                            window.__rte1=_form.onsubmit;

                               _form.onsubmit=function()
                             {
                                 updateRTE('rte1');
                                  alert("update OK")
                                  if(__rte1!=null)
                                  {
                                     __rte1();
                                  }
                             }
                                                </script>


     *
     *
     *
     */


    final public void renderInputPart(RenderContext rc)
        throws IOException
    {
        java.io.Writer w=rc.getOutputWriter();
        w.write("<textarea class=\"");
        w.write(this.css == null ? this.getType() : this.css);

        w.write("\" name=\"");

        w.write(this.name);
        if(this.style != null)
        {
            w.write("\" style=\"");
            w.write(this.style);

        }

        w.write("\" id=\"");

        w.write(this.name);

        w.write("\" >");

        w.write (com.mapbased.wfw.Util.replaceToXmlPreTextarea(
        rc.getSureSingleParam(name)));
        w.write("</textarea>");

    }



    final protected String getType()
    {
        return "textarea";
    }
}
